<template>
    <div>setup</div>
    <SetupSon one="aaaa" @myadd="padd" two="bbbbb"  three="cccccc"  ref="oneSon">
      <h2>父组件的内容</h2>
    </SetupSon>
  <br>
  num:{{num}}
  <br>
  <button @click="subSon">子组件--</button>
</template>

<script>
import SetupSon from "../components/SetupSon";
export default {
  name: "Setup",
  data(){
    return{
      num:1
    }
  },
  setup(props,context){
    // context.refs.oneSon.sub();//此方法验证是错误的
  },
  components:{
    SetupSon
  },
  methods:{
    add(){
      this.num++;
    },
    // subSon(){
    //   //通过调用别名来调用子组件的sub()方法
    //   this.$refs.oneSon.sub();
    // },
    padd(i){
      this.num += i;
    }
  }
}
</script>

<style scoped>

</style>